//
//  YKProcessTrackingItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/10/3.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKProcessTrackingItemCell.h"
#import "YKDashView.h"
@interface YKProcessTrackingItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *auditNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *auditTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *auditDateLabel;
@property (weak, nonatomic) IBOutlet UILabel *processNodeLabel;

@end


@implementation YKProcessTrackingItemCell
@dynamic tableViewItem;
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)cellLoadSubViews {
    [super cellLoadSubViews];
//    self.processNodeLabel.tf_weight = 1;
//    self.auditNameLabel.tf_weight = 1;
//    self.auditTextLabel.tf_weight = 1;
//    self.auditDateLabel.tf_weight = 1;
//
//    self.processNodeLabel.textAlignment = NSTextAlignmentCenter;
//    self.auditNameLabel.textAlignment = NSTextAlignmentCenter;
//    self.auditTextLabel.textAlignment = NSTextAlignmentCenter;
//    self.auditDateLabel.textAlignment = NSTextAlignmentCenter;
//
//    [@[self.processNodeLabel,self.auditNameLabel, self.auditTextLabel, self.auditDateLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(self.contentView.mas_centerY);
//        make.top.equalTo(self.contentView.mas_top).offset(11);
//    }];
//    [@[self.processNodeLabel,self.auditNameLabel, self.auditTextLabel, self.auditDateLabel] mas_alignWeightlyAlongAxis:MASAxisTypeHorizontal
//                                                                                                            fixedSpace:@4
//                                                                                                             leadingTo:self.contentView.mas_leading
//                                                                                                             leadSpace:13
//                                                                                                            trailingTo:self.contentView.mas_trailing
//            tailSpace:13];


    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
    
}

- (void)cellWillAppear {
    [super cellWillAppear];
    self.processNodeLabel.text = [NSString stringWithFormat:@"审批节点:%@", self.tableViewItem.model.name];
    self.auditNameLabel.text = [NSString stringWithFormat:@"审批人:%@",self.tableViewItem.model.assignee];
    self.auditTextLabel.text = [NSString stringWithFormat:@"审批意见:%@", self.tableViewItem.model.mark];
    self.auditDateLabel.text = [NSString stringWithFormat:@"审批时间:%@",self.tableViewItem.model.start];
    
    [self.contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        if ([obj isKindOfClass:[UILabel class]]) {
            UILabel *label = (UILabel *)obj;
            label.textColor = [UIColor blackColor];
        }
    }];
}

@end
